package com.lizemin.importcase.controller;

import com.lizemin.importcase.entity.Teacher;
import com.lizemin.importcase.mapper.TeacherMapper;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.mapper.MapperFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lzm
 * @date 2025/10/20 19:04
 * @description
 */
@RestController
public class TestController {

    @Autowired
    TeacherMapper teacherMapper;

    @Autowired
    SqlSessionTemplate sessionTemplate;

    @Autowired
    MapperFactoryBean<TeacherMapper> mapperFactoryBean;

    @GetMapping("/heartbeat")
    public String heartbeat() {
        return "success";
    }

    @GetMapping("/listTeachers")
    public List<Teacher> listTeachers() {
        return teacherMapper.selectList(null);
    }

    @GetMapping("/compareSqlSessionTemplate")
    public void compareSqlSessionTemplate() {
        System.out.println(sessionTemplate);
        System.out.println(mapperFactoryBean.getSqlSession());
    }


}
